package com.chris.libs.example.common.application;

import com.chris.dev.base.libs.v1.http.protocols.HttpHeader;
import com.chris.libs.base.x.mvpp.application.BaseApplication;
import com.chris.libs.devtools.x.v1.utils.UtilsManager;
import com.chris.libs.http.x.v1.NetApi;

/**
 * @author Chris chan
 * Create on： 2025/2/1 9:59
 * Use for:
 * Explain:
 */
public class ExampleApplication extends BaseApplication {
    @Override
    protected void init() {
        UtilsManager.init(getApplicationContext());
        initNetProtocol();
        //全局Token 不合适
//        NetClient.addInterceptor(chain -> {
//            Request request = chain.request()
//                    .newBuilder()
//                    .addHeader("Authorization", "Bearer thismyauthorizationtoken")
//                    .build();
//            return chain.proceed(request);
//        });
    }

    /**
     * 初始化网络协议
     */
    private void initNetProtocol() {
        HttpHeader head = HttpHeader.create()
                .setOs("Android")
                .setVer("1.0.0")
                .setChannel("OPPO")
                .setAppId("Worker")//应该采用算法加密
                .setAppSecret("Worker Android");//应该采用算法加密
        NetApi.initHeader(head);
    }
}
